package com.dtsheep.elasticsearch.base;


import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * Kuaidi100Result
 *
 * <p>
 *     快递100 推送/响应结果
 * </p>
 *
 * @author chuanbai
 * @date 2024/5/21
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Kuaidi100Result {

    /**
     * true表示成功，false表示失败
     * 如果提交回调接口的地址失败，30分钟后重新回调，3次仍旧失败的，自动放弃
     */
    private Boolean result;

    /**
     * 200: 提交成功 500: 服务器错误 .....
     */
    private String returnCode;

    /**
     * 返回的提示
     */
    private String message;

    public final static Boolean SUCCESS_RESULT = Boolean.TRUE;
    public final static Boolean ERROR_RESULT = Boolean.FALSE;
    public final static String SUCCESS_CODE = "200";
    public final static String ERROR_CODE = "500";
    public final static String NOAUTH_CODE = "403";
    public final static String PARAM_ERROR_CODE = "701";
    public final static String SUCCESS_MESSAGE = "成功";
    public final static String ERROR_MESSAGE = "失败";
    public final static String NOAUTH_MESSAGE = "签名未通过";
    public final static String PARAM_ERROR_MESSAGE = "推送参数解析失败";


    public static Kuaidi100Result ok(){
        return new Kuaidi100Result(SUCCESS_RESULT, SUCCESS_CODE, SUCCESS_MESSAGE);
    }

    public static Kuaidi100Result error(){
        return new Kuaidi100Result(ERROR_RESULT, ERROR_CODE, ERROR_MESSAGE);
    }

    public static Kuaidi100Result noAuthError(){
        return new Kuaidi100Result(ERROR_RESULT, NOAUTH_CODE, NOAUTH_MESSAGE);
    }
    public static Kuaidi100Result paramError(){
        return new Kuaidi100Result(ERROR_RESULT, PARAM_ERROR_CODE, PARAM_ERROR_MESSAGE);
    }

}